package com.solcoo.dao;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.solcoo.pojo.TempKeHu;

@Repository
public class TempKeHuDao {

	@Resource
	private SqlMapClient sqlMapClient;
	
    // 根据商户ID获取客户List
    public List<TempKeHu> queryList(int shanghuid, int youbiao) throws SQLException {
    	Map<String, Object> param = new HashMap<String, Object>();
    	param.put("yonghuid", shanghuid);
        if(youbiao > 0)
        	param.put("youbiao", youbiao);
        return sqlMapClient.queryForList("selectKHListBySHID", param);
    }

    // 根据商户ID和个人ID获取客户
    public TempKeHu query(int shanghuid, int gerenid) throws SQLException {
    	Map<String, Object> param = new HashMap<String, Object>();
    	param.put("gerenid", gerenid);
        param.put("shanghuid", shanghuid);
        return (TempKeHu) sqlMapClient.queryForObject("selectKHBySellerIdAndUserId", param);
    }

}
